<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回调界面</title>
    <!--在导入common.js之前,一定要先导入vue和axios 否则common.js中会报错-->
    <script src="plug/vue/dist/vue.js"></script>
    <script src="plug/axios/dist/axios.js"></script>
    <script src="script/commons.js"></script>
</head>
<body>
    <div id="app"></div>
</body>
<script type="text/javascript">
    new Vue ({
        el:"#app",
        data:{

        },
        methods:{

        },
        mounted(){
            let urlParam = getUrlParam();
            this.$http.post("/login/wechat",urlParam)
                .then(result =>{
                    let obj = result.data.obj
                    if (obj.message ==="noBind"){
                        location.href = "/binder.html?accessToken="+obj.accessToken+"&openid="+obj.openid;
                    }else {
                        localStorage.setItem("token",obj.token);
                        localStorage.setItem("loginUser",obj.loginUser);
                        location.href = "/index.html"
                    }
                })
                .catch(result =>{

                })
        }
    })
</script>
</html>